package com.mdxq.mall.listener;

import com.mdxq.mall.entity.Person;
import com.rabbitmq.client.Channel;
import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.amqp.rabbit.config.SimpleRabbitListenerContainerFactory;
import org.springframework.amqp.rabbit.connection.ConnectionFactory;
import org.springframework.amqp.rabbit.listener.api.ChannelAwareMessageListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.stereotype.Component;

import java.nio.charset.StandardCharsets;

//@Component
@Slf4j
//@RabbitListener(queues = "normal_queue")
//消息监听器：监听某个队列，当消息进入队列后执行方法，消费信息
public class MyMessageListener2 {
//    @RabbitHandler  //当符合格式的消息到来时，自动执行这个注解下的方法
    public void process(Person person){
        String s = "消费者Y接收到新消息，内容：{}";
        log.info(s,person);
    }
}
